Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

255
Vistas
Solidity Js, on function get i get an error as "TypeError: Data location must be "memory" or "calldata" for return parameter in function

`

//SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

contract MyContract{

string value;
constructor() public   {
    value = "MyValue";
}
function get() public returns(string)  {
    return value;
}

function set(string memory _value) public  {
    value = _value;
}


}`

on function get i get an error as TypeError: Data location must be "memory" or "calldata" for return parameter in function, but none was given. i couldnt solve it because the "value" variable is already identified it doesn neew to be memoried

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

string is a reference type, so you need to specify its data location. In this case, the value is loaded from storage to memory, and then returned from the memory.

function get() public returns(string memory)  {
    return value;
}
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda